package ui;

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

//纯UI类
public abstract class Button extends Label implements MouseListener, MouseTrackListener{

	private Image deactive;
	private Image active;
	public Button(Composite parent, int style) {
		super(parent, style);
	}
	public void initial(Image deactive, Image active) {
		this.active = active;
		this.deactive = deactive;
		addMouseListener(this);
		addMouseTrackListener(this);
		setImage(deactive);
	}
	@Override
	protected void checkSubclass() {}
	@Override
	public void mouseEnter(MouseEvent e) {
		setImage(active);
	}
	@Override
	public void mouseExit(MouseEvent e) {
		setImage(deactive);
	}
	@Override
	public void mouseHover(MouseEvent e) {}
	@Override
	public void mouseDoubleClick(MouseEvent e) {}
	@Override
	public void mouseDown(MouseEvent e) {}
	
}
